package definite.Guide.Book.ProgressMonitor.ProgressBar;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProgressInputSample {

	public static final int NORMAL = 0;
	public static final int BAD_FILE = 1;
	public static final int CANCELED = NORMAL;
	public static final int PROBLEM = 2;

	public static void main(String[] args) {
		/*try {
			FileInputStream fis = new FileInputStream("data.txt");
			JLabel filenameLable = new JLabel("Data", JLabel.RIGHT);
			Object message[] = { "Reading : ", filenameLable };
			ProgressMonitorInputStream pmis =
				new ProgressMonitorInputStream(null, message, fis);
			InputStreamReader isr = new InputStreamReader(pmis);
			BufferedReader bfr = new BufferedReader(isr);
			String line;
			while ((line = bfr.readLine()) != null)
				System.out.println(line);
			bfr.close();
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}

		System.exit(0);*/
		/*LineNumberReader lnr = null;
		try {
			lnr = new LineNumberReader(new FileReader(new File("data.txt")));
			lnr.skip(Long.MAX_VALUE);
		} catch (IOException e) {

			e.printStackTrace();
		}

		System.out.println(lnr.getLineNumber() + 1);*/

		try {
			InputStreamReader in =
				new InputStreamReader(new FileInputStream(new File("data.txt")));
			BufferedReader br = new BufferedReader(in);
			String line;
			while ((line = br.readLine()) != null)
				System.out.println(line);
		} catch (IOException e) {

			e.printStackTrace();
		}

	}

}
